package com.mrli.cat.weather.database;

import android.content.ContentResolver;
import android.net.Uri;
import android.provider.BaseColumns;

public class WeatherContract {
    public static final String SCHEME = "content";
    public static final String AUTHORITY = "com.mrli.cat.provide";

    public static final Uri LOCATION_CONTENT_URI = new Uri.Builder()
            .scheme(SCHEME)
            .authority(AUTHORITY)
            .path(LocationEntry.TABLE_NAME)
            .build();
    public static final Uri WEATHER_CONTENT_URI = new Uri.Builder()
            .scheme(SCHEME)
            .authority(AUTHORITY)
            .path(WeatherEntry.TABLE_NAME)
            .build();
    public static final Uri CITY_CONTENT_URI = new Uri.Builder()
            .scheme(SCHEME)
            .authority(AUTHORITY)
            .path(CityEntry.TABLE_NAME)
            .build();

    /**
     * 位置
     */
    public static final class LocationEntry implements BaseColumns {
        public static final String TABLE_NAME = "location";
        public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + "vnd." + AUTHORITY + "." + TABLE_NAME;
        public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + "vnd." + AUTHORITY + "." + TABLE_NAME;

        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_LAT = "lat";
        public static final String COLUMN_LON = "lon";
    }

    /**
     * 天气
     */
    public static class WeatherEntry implements BaseColumns {
        public static final String TABLE_NAME = "weather";
        public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + "vnd." + AUTHORITY + "." + TABLE_NAME;
        public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + "vnd." + AUTHORITY + "." + TABLE_NAME;

        public static final String COLUMN_TIME = "time";
        public static final String COLUMN_TEMP_MAX = "temp_max";
        public static final String COLUMN_TEMP_MIN = "temp_min";
        public static final String COLUMN_WEATHER = "weather";
        public static final String COLUMN_HUMI = "humidity";
        public static final String COLUMN_PRESSURE = "pressure";
        public static final String COLUMN_WIND_SPEED = "speed";
        public static final String COLUMN_WIND_DEG = "direction";
        public static final String COLUMN_CITY_ID = "city_ID";
    }

    /**
     * 城市信息
     */
    public static class CityEntry {
        public static final String TABLE_NAME = "city_info";
        public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + "vnd." + AUTHORITY + "." + TABLE_NAME;
        public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + "vnd." + AUTHORITY + "." + TABLE_NAME;
        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_LAT = "lat";
        public static final String COLUMN_LON = "lon";
        public static final String COLUMN_SORT = "sort_key";
    }

}
